<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>链接编辑</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
		<!--ios是否运行创建快捷启动方式-->
		<meta content="yes" name="apple-mobile-web-app-capable">
		<!--ios顶部通知栏的样式 黑色-->
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<!--遇到数字不让转成电话号码格式-->
		<meta content="telephone=no" name="format-detection">
		<script src="js/remstyle.js"></script>
		<link rel="stylesheet" href="assets/mui/css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="common/css/base.css" />
		<link rel="stylesheet" type="text/css" href="css/min_page.css" />
		<link rel="stylesheet" type="text/css" href="css/sameInfo.css" />

		<script type="text/javascript" src="js/vue.js"></script>
		<script type="application/javascript " src="js/jquery-1.7.2.min.js "></script>
		<script src="layer/layer.js"></script>
		<link rel="stylesheet" type="text/css" href="layer/skin/layer.css" />
		<link rel="stylesheet" type="text/css" href="css/material_link_edit.css" />
		<script src="js/config.js"></script>
	</head>
	<style>
		
	</style>

	<body>
		<form>
			<!--顶部-->
			<div class="top">
				<div class="top-one" onclick="javascript :history.back(-1);">
					<span><img src="img_page/right.png"/></span>
				</div>
				<div class="point">
					<img src="img_page/3point.png" />
				</div>
			</div>
			<!--内容信息-->
			<div class="phone_con">
				<div class="phone_title">
					<img src="img_page/phone_info.png" />
					<span>链接</span>
				</div>
				<div class="phone_info_input">
					<img src="img_page/link_name.png" />
					<input id='phone_name' type="text" placeholder="请输入链接名称" name="name" />
				</div>
				<div class="phone_info_input">
					<img src="img_page/link_address.png" />
					<input id='phone_number' type="text" placeholder="请输入链接地址" name="phone" />
				</div>
			</div>
			<!--样式信息-->
			<div class="phone_bgp">
				<div class="phone_title" style="margin-top:0.2rem ;">
					<img class="bgp_style" src="img_page/phone_style.png" />
					<span>样式选择</span>
				</div>
				<div class="phone_list">
					<label class="one_choose"><input type="radio"  name="template" value="0" checked />
				<img class="phone_list_bgp" src="img_page/link_bgp1.png" />
				<a class="link_con">这是一个链接</a>
				</label>
				</div>
				<div class="phone_list">
					<label class="one_choose"><input type="radio"  name="template" value="1"  />
				<img class="phone_list_bgp" src="img_page/link_bgp2.png" />
				<a class="link_con">这是一个链接</a>
				</label>
				</div>
				<div class="phone_list">
					<label class="one_choose"><input type="radio"  name="template" value="2"  />
				<img class="phone_list_bgp" src="img_page/link_bgp3.png" />
				<a class="link_con">这是一个链接</a>
				</label>
				</div>
				<div class="phone_list">
					<label class="one_choose"><input type="radio"  name="template" value="3"  />
				<img class="phone_list_bgp" src="./img_page/link_bgp4.png" />
				<a class="link_con">这是一个链接</a>
				</label>
				</div>
			</div>

			<!--底部-->

		</form>
		<div class="phone_bottom">
			<button>取消</button>
			<button onclick="phone_save()">保存</button>
		</div>
	</body>
	<script type="text/javascript">
		function phone_save() {

			console.log(4444)
			var content = document.getElementById("phone_name").value;
			var url = document.getElementById("phone_number").value;
			if(url.length>100){
				alert(1)
				return false;
			}
			//			var template = document.getElementById("phone_template").value;
			var template = document.getElementsByName('template')

			for(var i = 0; i < template.length; i++) {
				if(template[i].checked) {
					var template_val = $(template[i]).attr("value");
					console.log(template_val)
				}

			}
			console.log(content)
			if(!content || !url) {
				layer.msg("请输入完整信息")
			} else if(content.length>10) {
				layer.msg("链接名字不能超过10位")
			} else {
				$.ajax({
					type: "get",
					url:  v_url +"/wechat/material/saveUrl",
					data: {
						url: url,
						content: content,
						template: template_val,
						c_user_id:c_user_id,
					},
					async: true,
					success: function(res) {

						if(res.code == 200) {
							console.log(2222)
							layer.msg("保存成功", function() {
								window.location.reload()
							})

						} else {
							console.log(333)
							layer.msg("保存失败")
						}
					}
				});
			}

		}
		//		var phone_list = new Vue({
		//			el: '.phone_bgp',
		//			data: {
		//				phone_list: [{
		//					phone_bag: 'img_page/phone_Bagimg.png',
		//					phone_name: '乔治佩奇',
		//					phone_num: '123456789123',
		//				}, {
		//					phone_bag: 'img_page/phone_Bagimg2.png',
		//					phone_name: '乔治',
		//					phone_num: '123456789',
		//				}]
		//			}
		//		})
	</script>

</html>